a=input("введите скобочную последовательность")
cn=-1
g=["(",")","{","}","[","]","<",">"]
while "()" in a or "[]" in a or "{}" in a or "<>":
    cn+=1
    if a[cn] in g:
        a=a.replace("()","")
        a=a.replace("[]","")
        a=a.replace("<>","")
        a=a.replace("{}","")
    else:
        a=a.replace(a[cn],"")
print(a)
if len(a)==0:
    print("True")
else:
    print("False")
